Move start_time out of xend dir and use gather/store.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Wed, 14 Sep 2005 19:30:08 +0000 (19:30 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Wed, 14 Sep 2005 19:30:08 +0000 (19:30 +0000)
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
tools/python/xen/xend/XendDomainInfo.py

index 689177f5919bc5a3e3f97ec878c02d7cff9fdf34..0df0097f607550899d48f87688680aefd0dd9482 100644 (file)
@@ -149,7 +149,8 @@ class XendDomainInfo:
         path = "/".join(db.getPath().split("/")[0:-2])
         vm = cls(uuid, path, db)
         vm.setDomid(domid)
-        vm.name = vm.readVm("name")
+        vm.name, vm.start_time = vm.gatherVm(("name", str),
+                                             ("start-time", float))
         try:
             db.readDB()
         except: pass
@@ -204,7 +205,6 @@ class XendDomainInfo:
 
     __exports__ = [
         DBVar('config',        ty='sxpr'),
-        DBVar('start_time',    ty='float'),
         DBVar('state',         ty='str'),
         DBVar('restart_mode',  ty='str'),
         DBVar('restart_state', ty='str'),
@@ -274,6 +274,12 @@ class XendDomainInfo:
     def removeVm(self, *args):
         return xstransact.Remove(self.path, *args)
 
+    def gatherVm(self, *args):
+        return xstransact.Gather(self.path, *args)
+
+    def storeVm(self, *args):
+        return xstransact.Store(self.path, *args)
+
     def readDom(self, *args):
         return xstransact.Read(self.path, *args)
 
@@ -283,6 +289,12 @@ class XendDomainInfo:
     def removeDom(self, *args):
         return xstransact.Remove(self.path, *args)
 
+    def gatherDom(self, *args):
+        return xstransact.Gather(self.path, *args)
+
+    def storeDom(self, *args):
+        return xstransact.Store(self.path, *args)
+
     def setDB(self, db):
         self.db = db
 
@@ -800,6 +812,7 @@ class XendDomainInfo:
             return
         if self.start_time is None:
             self.start_time = time.time()
+            self.storeVm(("start-time", self.start_time))
         try:
             cpu = int(sxp.child_value(self.config, 'cpu', '-1'))
         except: